package spring.cloud.tasks.executor.common;

import lombok.Getter;
import lombok.Setter;
import spring.cloud.tasks.executor.listener.config.TaskConfiguration;
import spring.cloud.tasks.executor.node.TaskNodeStorage;
import spring.cloud.tasks.executor.task.TaskExecutor;
import spring.cloud.tasks.executor.utils.zookeeper.Zookeeper;

@Setter
@Getter
public abstract class Service implements Lifecycle {
    public Zookeeper zookeeper;
    public String executorId;
    public String taskId;
    public TaskConfiguration taskConfiguration;
    public TaskNodeStorage taskNodeStorage;
    public TaskExecutor taskExecutor;


    public Service(final TaskExecutor taskExecutor) {
        this.zookeeper = taskExecutor.getZookeeper();
        this.executorId = taskExecutor.getExecutorId();
        this.taskId = taskExecutor.getTaskId();
        this.taskConfiguration = taskExecutor.getTaskConfiguration();
        this.taskNodeStorage = taskExecutor.getTaskNodeStorage();
        this.taskExecutor = taskExecutor;
    }

    /**
     * 服务启用
     */
    public void start() {

    }

    @Override
    public void stop() {
    }
}
